<template>
    <view class="ineedBuy">
        <view class="bidList_entire">
            <view class="bidList_images">
                <image src="{{detail.topicImage }}" mode="aspectFit" style="height: 200px"></image>
            </view>
            <view style="text-align: center;">{{detail.name}}</view>
            <view class="bidList_flex">
                <view class="bidList_flex1 backf5f5f9">
                    <text>卖家最低售价</text>
                    <view class="border-right" style="background: #fff"></view>
                </view>
                <view class="bidList_flex2 backf5f5f9">
                    <view class="bidList_pire">￥
                        <text>{{detail.minSellerOfferAmount}}</text>
                    </view>
                </view>
                <view class="bidList_flex3 backe6e6e6">
                    <text>买家最高出价</text>
                    <view class="border-right" style="background: #fff"></view>
                </view>
                <view class="bidList_flex4 backe6e6e6">
                    <view class="bidList_pire">￥
                        <text>{{detail.maxBuyerOfferAmount}}</text>
                    </view>
                </view>
            </view>
        </view>
        <view class="pofix">
            <view class="btn_to">
                <view @tap="urlTo('/pages/bidList/ineedBuy')">我要出价</view>
                <view @tap="urlTo('/pages/personalCenter/purchase','buy')">立即购买</view>
            </view>
        </view>
    </view>
</template>
<script>
import wepy from 'wepy'
import api from '@/api/api'
import tip from '@/utils/tip'
import { GOODSDETAIL, CHOOSECOU } from '@/utils/constant'

export default class buyerBidList extends wepy.page {
    config = {
        // 配置当前页面

        navigationBarTitleText: '买家出价' // 头部标题
    }
    components = {}

    data = {
        detail:'',
        form:{}
    }

    methods = {
        // 方法
        urlTo(url,type){
            wx.removeStorageSync(CHOOSECOU);
            const t = this;
            if (type == 'buy') {
                let sel = t.detail.minSellerOfferId
                if (!sel) {
                    tip.alert('暂无卖家，不能购买')
                } else {
                    wx.navigateTo({
                        url: url
                    })
                }
            } else{
                wx.navigateTo({
                    url:url
                })
            }
        }
    }
    events = {}
    onLoad() {
        const t = this;
        let detail = wx.getStorageSync(GOODSDETAIL);
        if(detail){
            t.detail = detail;
        }
    }
}
</script>
<style lang="less">
.ineedBuy {
    .pofix {
        position: fixed;
        bottom: 0;
        width: 100%;
        .btn_to {
            display: flex;
            > view {
                width: 50%;
                font-size: 36rpx;
                height: 95rpx;
                line-height: 95rpx;
                text-align: center;
            }
            > view:first-child {
                background: #ffb025;
                color: #fff;
            }
            > view:last-child {
                background: #fff;
                color: #333;
            }
        }
    }
    > view:first-child {
        margin-top: 0 !important;
    }
    > view {
        margin-top: 20rpx;
    }
    .bidList_entire {
        .bidList_images{
            text-align: center;
        }
        .backf5f5f9 {
            background: #FFA622;
            color: #fff;
        }
        .back_fff {
            background: #fff;
        }
        .backe6e6e6 {
            background: #70B957;
            color: #fff;
        }
        .color_org {
            color: #ffb025;
        }

        .bidList_flex_sta {
            display: flex;
            justify-content: flex-start;
            padding: 20rpx 0;
            background: #fff;
            > view:first-child {
                width: 30%;
                text-align: left;
                text {
                    padding-left: 20rpx;
                }
            }
            > view:nth-child(2) {
                padding-left: 40rpx;
            }
            > view:last-child {
                margin-left: auto;
                width: 10%;
                text-align: center;
            }
        }
        .bidList_flex {
            display: flex;
            justify-content: flex-start;
            .bidList_flex1 {
                width: 30%;
                overflow: hidden;
                padding: 20rpx 0;
                position: relative;
                text {
                    padding-left: 20rpx;
                }
                .border-right {
                    position: absolute;
                    top: 4rpx;
                    right: 0;
                    width: 2rpx;
                    height: 80rpx;
                }
            }
            .bidList_flex2 {
                width: 20%;
                text-align: right;
                padding: 20rpx 0;
                .bidList_pire {
                    font-size: 22rpx;
                    color: #fff;
                    text {
                        padding-right: 20rpx;
                        font-size: 30rpx;
                    }
                }
            }
            .bidList_flex3 {
                width: 30%;
                position: relative;
                padding: 20rpx 0;
                .modification {
                    text-align: right;
                    view:first-child {
                        width: 50rpx;
                        height: 50rpx;
                    }
                    view {
                        display: inline-block;
                        i {
                            vertical-align: middle;
                            font-size: 36rpx;
                            padding-right: 10rpx;
                        }
                        text {
                            padding-left: 0;
                            vertical-align: middle;
                            display: inline-block;
                        }
                    }
                }
                text {
                    padding-left: 20rpx;
                }
                .border-right {
                    position: absolute;
                    top: 4rpx;
                    right: 0;
                    width: 2rpx;
                    height: 80rpx;
                    color: #fff;
                }
            }
            .bidList_flex4 {
                width: 20%;
                text-align: center;
                padding: 20rpx 0;
                .bidList_pire {
                    font-size: 22rpx;
                    color: #fff;
                    text {
                        font-size: 30rpx;
                    }
                }
                .modification {
                    view:first-child {
                        width: 50rpx;
                        height: 50rpx;
                    }
                    view {
                        display: inline-block;
                        i {
                            vertical-align: middle;
                            font-size: 32rpx;
                            padding-right: 10rpx;
                        }
                        text {
                            padding-left: 0;
                            vertical-align: middle;
                            display: inline-block;
                        }
                    }
                }
            }
            .ineedBuy_chujia {
                background: #fff;
                display: flex;
                > text:first-child {
                    vertical-align: middle;
                    height: 100rpx;
                    line-height: 100rpx;
                    padding-left: 40rpx;
                    font-size: 22rpx;
                }
                > view {
                    vertical-align: middle;
                    padding: 20rpx 0;
                    padding-right: 30rpx;
                    input {
                        background: #e6e6e6;
                        border: 1px solid #999;
                        width: 320rpx;
                    }
                }
                > text:last-child {
                    vertical-align: middle;
                    width: 120rpx;
                    font-size: 22rpx;
                    padding: 10rpx 0;
                }
            }
        }
    }
}
</style>
